package com.str.algorithm;
public class Powers {
    
  public static long power(int b, int n) {
    long product = 1;
    for (int i = 1; i <= n; i++)
      product *= b;
    return product;
  }
      
  public static long power2(int b, int n) {
    if (n == 0)
      return 1;
    else
      return b * power2(b, n-1);
  }

  public static void main(String[] args) {
    for (int n = 0; n <= 10; n++)
      System.out.println(n
        + "  " + power(2, n)
        + "  " + power2(2, n));
  } 
}
